package com.tiantian.quanminxiu.model;

import com.shenglian.utils.utils.DateUtils;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.Date;
import java.util.concurrent.LinkedBlockingQueue;

public class UserData_Current {
    public int mid = -1;
    public String sign = "";
    public int Main_PageIndex = 0;//首页页面索引
    public String Equipment_Name = "";// 设备名称
    public String APP_Version = "";// 应用版本号
    public int APP_VersionCode = -1;// 用户版本号码
    public String OS_Version = "";// 系统版本
    public int Screen_Width = 0;// 用户屏幕宽
    public int Screen_Height = 0;// 用户屏幕高(除去状态栏和操作栏)
    public boolean Location_City_Baidu = false;//百度定位
    public boolean Location_City_Edit = false;//是否手动修改过城市
    public int Location_City_ID = -1;//所在城市
    public String Location_City_Name = "";//所在城市名
    public double Location_City_Latitude = -1;// 城市纬度
    public double Location_City_Longitude = -1;// 城市经度
    public android.content.Intent Login_Next = null;//验证手机完成后转入页

    public String GIFTPIC_URL = "";//礼物图片地址
    public String USERCOVER_URL = "";//主播封面图片地址
    public String USERAVATAR_URL = "";//主播头像图片地址
    public JSONArray GiftList;//礼物列表
    public JSONArray GuardConfigList;//守护配置列表
    public JSONArray WeekStar;  //周星列表
    public LinkedBlockingQueue<JSONObject> AnchorGiftList;  //当前艺人礼物列表
    public JSONArray GuardList;  //当前守护列表
    public org.json.JSONObject CommonConfig;//配置文件


    private final int AnchorGiftCount = 50;
    public void addAnchorGift(JSONObject object) {
        try {
            object.put("CreateDate", DateUtils.format(new Date(System.currentTimeMillis()),"HH:mm:ss"));
            if(AnchorGiftList==null){
                AnchorGiftList = new LinkedBlockingQueue<JSONObject>(AnchorGiftCount*2);
            }
            if(AnchorGiftList.size()>AnchorGiftCount){
                AnchorGiftList.poll();
            }
            AnchorGiftList.add(object);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
}
